(function () {
  var ie = !!(window.attachEvent && !window.opera);
  var wk = /webkit\/(\d+)/i.test(navigator.userAgent) && (RegExp.$1 < 525);
  var fn = [];
  var run = function () { for (var i = 0; i < fn.length; i++) fn[i](); };
  var d = document;
  d.ready = function (f) {
    if (!ie && !wk && d.addEventListener)
      return d.addEventListener('DOMContentLoaded', f, false);
    if (fn.push(f) > 1) return;
    if (ie)
      (function () {
        try { d.documentElement.doScroll('left'); run(); }
        catch (err) { setTimeout(arguments.callee, 0); }
      })();
    else if (wk)
      var t = setInterval(function () {
        if (/^(loaded|complete)$/.test(d.readyState))
          clearInterval(t), run();
      }, 0);
  };
})();
String.prototype.sub = function(t) {
    var e = /[^\x00-\xff]/g;
    if (this.replace(e, "mm").length <= t) return this;
    for (var n = Math.floor(t / 2), i = n; i < this.length; i++) if (this.substr(0, i).replace(e, "mm").length >= t) return this.substr(0, i) + "...";
    return this;
};

function genMenu(){
    for (var t = document.getElementsByTagName("h3"), e = "", n = "", i = "", l = 0; l < t.length; l++) $h3 = t[l], 
    n = $h3.childNodes[0].hash, i = $h3.innerText || $h3.textContent, e += '<li class="menu-title" style="margin:10px 0;"><a style="color:#4183c4;text-decoration:none;" href="' + n + '" title="' + i + '">' + i.sub(45) + "</a></li>";
    var o = document.getElementById("menu");
    o || (o = document.createElement("div"), o.setAttribute("id", "menu")), o.innerHTML = '<ul id="doc_menu" style="list-style:none;display:block-inline;font-size:12px;">' + e + "</ul>", 
    document.getElementsByTagName("body")[0].setAttribute("style", ""), o.setAttribute("style", "position:fixed;left:0;top:20px;"), 
    document.body.appendChild(o);
}

document.ready(function(){
    genMenu();
});


